# -*- coding: utf-8 -*-
# @File: backend => users.py
# @CreateTime: 2025/8/25 11:20
# @Author: EvanZhang
# @Info: 用户模型类

from tortoise import fields, models

# id(pk) | username | password_hash | avatar_url | chips | created_at
class User(models.Model):
    id = fields.IntField(pk=True)
    username = fields.CharField(max_length=50, unique=True, index=True, description="用户名")
    password_hash = fields.CharField(max_length=128, description="密码/哈希值")
    avatar_url = fields.CharField(max_length=255, null=True, description="头像URL")
    chips = fields.IntField(default=1000, description="筹码数量")
    created_at = fields.DatetimeField(auto_now_add=True, description="创建时间")

    class Meta:
        table = "users"
        description = "用户表"